package com.mantbox.channelcall.utils;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;

/*模拟设备机型*/
public class IphoneModelUtils {
    static List<String> phoneArrs;

    private static List<String> getPhoneArrs() {
        if (phoneArrs == null) {
            phoneArrs = new ArrayList<>();
            phoneArrs.add("iPhone 16 Pro Max");
            phoneArrs.add("iPhone 16 Pro Max");
            phoneArrs.add("iPhone 16 Pro");
            phoneArrs.add("iPhone 16 Pro");
            phoneArrs.add("iPhone 16 Pro");
            phoneArrs.add("iPhone 16 Plus");
            phoneArrs.add("iPhone 16 Plus");
            phoneArrs.add("iPhone 16 Plus");
            phoneArrs.add("iPhone 16 Plus");
            phoneArrs.add("iPhone 16 Plus");
            phoneArrs.add("iPhone 16 Plus");
            phoneArrs.add("iPhone 16");
            phoneArrs.add("iPhone 15 Pro Max");
            phoneArrs.add("iPhone 15 Pro Max");
            phoneArrs.add("iPhone 15 Pro Max");
            phoneArrs.add("iPhone 15 Pro");
            phoneArrs.add("iPhone 15 Plus");
            phoneArrs.add("iPhone 15 Plus");
            phoneArrs.add("iPhone 15 Plus");
            phoneArrs.add("iPhone 15 Plus");
            phoneArrs.add("iPhone 15 Plus");
            phoneArrs.add("iPhone 15");
            phoneArrs.add("iPhone 14 Pro Max");
            phoneArrs.add("iPhone 14 Pro Max");
            phoneArrs.add("iPhone 14 Pro");
            phoneArrs.add("iPhone 14 Pro Max");
            phoneArrs.add("iPhone 14 Pro Max");
            phoneArrs.add("iPhone 14 Pro");
            phoneArrs.add("iPhone 14 Pro");
            phoneArrs.add("iPhone 14 Pro");
            phoneArrs.add("iPhone 14 Plus");
            phoneArrs.add("iPhone 14");
            phoneArrs.add("iPhone 13 Pro Max");
            phoneArrs.add("iPhone 14 Pro");
            phoneArrs.add("iPhone 14 Pro");
            phoneArrs.add("iPhone 14 Plus");
            phoneArrs.add("iPhone 14");
            phoneArrs.add("iPhone 13 Pro Max");
            phoneArrs.add("iPhone 13 Pro");
            phoneArrs.add("iPhone 13 Mini");
            phoneArrs.add("iPhone 13");
            phoneArrs.add("iPhone 12 Pro Max");
            phoneArrs.add("iPhone 12 Mini");
            phoneArrs.add("iPhone 12");
            phoneArrs.add("iPhone 11 Pro Max");
            phoneArrs.add("iPhone 11 Pro");
            phoneArrs.add("iPhone 11");
            phoneArrs.add("iPhone XR");
            phoneArrs.add("iPhone XS Max");
            phoneArrs.add("iPhone XS");
            phoneArrs.add("iPhone X");
            phoneArrs.add("iPhone SE3");
            phoneArrs.add("iPhone SE2");
            phoneArrs.add("iPhone SE");
            phoneArrs.add("iPhone 8 Plus");
            phoneArrs.add("iPhone 8");
            phoneArrs.add("iPhone 7 plus");
            phoneArrs.add("iPhone 6s plus");
            phoneArrs.add("iPhone 6s");
            phoneArrs.add("iPhone 6 plus");
            phoneArrs.add("iPhone 6");
        }
        return phoneArrs;
    }

    public static String getPhoneModel() {
        String phone = "";
        Random random = new Random();
        int position = random.nextInt(getPhoneArrs().size() - 1);
        phone = getPhoneArrs().get(position);
        try {
            phone = URLEncoder.encode(phone,"UTF-8");
            phone = phone.replaceAll("\\+", "%20");
        } catch (UnsupportedEncodingException e) {
            throw new RuntimeException(e);
        }
        return phone;
    }
}
